<?php
session_start();

$username=$_SESSION['username'];
$connetc=mysql_connect("localhost","root","");
mysql_select_db("shenji",$connetc);
mysql_query("set names utf8");
$sql4="select * from user where username='$username'";

$result4=mysql_query($sql4);
$row4=mysql_num_rows($result4);


if($row4==0){
	echo "<script>alert('用户不存在，请重新登录！');top.location.href='./login.php'</script>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="js/jquery.js"></script>

</head>

<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">接口配置</a></li>
    <li><a href="#">添加机器码</a></li>			
    </ul>
    </div>
	
    <div class="formbody">
    <div class="formtitle"><span>基本信息</span></div>
	<form method="post" action="insert_jiekou_commit.php">
	<input size="20" type="hidden" name="id" value="<?php echo $row['id'];?>">
    <ul class="forminfo">
    <!-- <li><label>机器码</label><input  id="licesneid" name="licesneid" type="text"  onblur="shouzhong_name();" class="dfinput" /><i id="yz_name" style="display:none">licesneid格式不正确</i></li> -->
	<li><label>机器码、备注</label><textarea id="licesneid" name="licesneid" onblur="shouzhong_beizhu();" style="width:325px;height:150px;" class="textinput"></textarea><i id="yz_beizhu" style="display:none;color:#f00;">机器码、备注由中文、英文、数字组成！机器码、备注必填</i>
	</li>
	<li>
		<label>类型</label>
		<select name="typeid" style="width:86px;height:34px;border:1px solid #ccc;">
		<?php $sql="select * from type"; $result=mysql_query($sql); while($row=mysql_fetch_assoc($result)){?>
			<option value="<?php echo $row['typeid'] ?>"><?php echo $row['name'] ?></option>
		<?php } ?>
		</select>
	</li>
	<li><span style="color:#666;font-size:12px;">注意:机器码,备注用英文逗号隔开,且每一条以回车隔开</span></li>
    <li><label>&nbsp;</label><input type="submit" name="submit" class="btn" value="确认保存"/></li>
    </ul>
	</form>
    </div>
</body>
</html>

<script>
/*   function shouzhong_beizhu(){
	var licesneid=/[\u4e00-\u9fa5a-zA-Z0-9]{3,32}[,]{1}[\u4e00-\u9fa5a-zA-Z.:0-9\n\r]{3,32}$/;
	if(licesneid.test($('#licesneid').val())){
		$("#yz_beizhu").hide();
	}else{
		$("#yz_beizhu").show();
	}
	}*/
	$(function(){

	$("#licesneid").focus(function(){
		$("#yz_beizhu").hide();
	})
	
})
	$(function(){
		$('.btn').bind('click',function(event){
			var licesneid=/[\u4e00-\u9fa5a-zA-Z0-9]{3,32}[,]{1}[\u4e00-\u9fa5a-zA-Z.:0-9\n\r]{3,32}$/;
			if(licesneid.test($('#licesneid').val())){
				$("#yz_beizhu").hide();				
			}else{
				$("#yz_beizhu").show();			
				return false;
			}			
		})
	})
	 $(document).ready(function(){
	  
	  var username="<?php echo $_SESSION['username']; ?>";
	  if(username==null||username.length==0){		  
		 window.top.location.href="../login.php";
	  }
	  
  })
</script>




